package think.net2;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;

import org.apache.commons.lang3.StringUtils;

public class Client {
	
	public static void main(String[] args) throws Exception{
		@SuppressWarnings("resource")
		final Socket soc = new Socket("127.0.0.1", 8787);
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		BufferedReader reader = new BufferedReader(new InputStreamReader(soc.getInputStream()));
		PrintWriter pw = new PrintWriter(soc.getOutputStream());

		String s = null;
		do{
			s = in.readLine();
			pw.println(s);
			pw.flush();
			System.out.println("客戶端:" + reader.readLine());
			
		}while(StringUtils.isNotBlank(s));
	}
}
